<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>聚合点位</title>

    <link rel="stylesheet" href="http://127.0.0.1/arcgis_js_api/library/4.11/esri/css/main.css">
    <link rel="stylesheet" href="css/mainApp.css">



    <script src="../dist/config.js"></script>

    <script src="http://127.0.0.1/arcgis_js_api/library/4.11/init.js"></script>
    <script>


        // Load the Map and MapView modules
        require(["esri/Map",

            "dextra/layers/GoogleImageLayer",
            "dextra/modules/viewers/SceneViewer",
            "dextra/layers/ClusterLayer",
            "esri/geometry/Point",

            "dojo/domReady!src/heatMapdemo"], function(Map, GoogleImageLayer, SceneViewer, ClusterLayer, Point) {
            var data = [
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.11,
                            "latitude": 24.84
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.18,
                            "latitude": 24.83,
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.24,
                            "latitude": 24.98
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.26,
                            "latitude": 24.36
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.46,
                            "latitude": 25.49
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.12,
                            "latitude": 24.95
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.15,
                            "latitude": 24.98
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.16,
                            "latitude": 24.91
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.23,
                            "latitude": 24.90
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.23,
                            "latitude": 24.88
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.1,
                            "latitude": 24.93
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.13,
                            "latitude": 24.96
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.27,
                            "latitude": 24.88
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.26,
                            "latitude": 24.87
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.14,
                            "latitude": 25.04
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.12,
                            "latitude": 24.15
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.104,
                            "latitude": 24.98
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.01,
                            "latitude": 24.46
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.18,
                            "latitude": 24.96
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.104,
                            "latitude": 24.23
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.33,
                            "latitude": 24.85
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.17,
                            "latitude": 24.89
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.1,
                            "latitude": 24.87
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.68,
                            "latitude": 24.1
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.01,
                            "latitude": 24.73
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.88,
                            "latitude": 24.25
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.12,
                            "latitude": 24.05
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.17,
                            "latitude": 24.73
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.18,
                            "latitude": 24.69
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.15,
                            "latitude": 24.66
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.098,
                            "latitude": 24.51
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.99,
                            "latitude": 24.57
                        }
                    },
                    {
                        "attributes": {

                        },
                        "geometry": {  spatialReference: {wkid: 102100},
                            "longitude": 103.19,
                            "latitude": 24.69
                        }
                    },

            ];


            var layer=new GoogleImageLayer();
            var clusterLayer=new ClusterLayer();

            var myMap = new Map({
                //  basemap:"topo",
                layers:[layer,clusterLayer]
            });


            var viewer = new SceneViewer({
                map: myMap,
                viewNode: "viewDiv",
            });


            viewer.view.whenLayerView(clusterLayer).then(function(){
                viewer.view.center=new Point({
                    longitude:104,
                    latitude:24,
                    spatialReference:viewer.view.spatialReference
                })

                data.forEach(function(point){
                    point=new Point({
                        longitude:point.geometry.longitude,
                        latitude:point.geometry.latitude,
                        spatialReference:viewer.view.spatialReference
                    });

                    clusterLayer.add(point);

                })

            });




        });
    </script>


</head>
<body>

<div id="viewDiv"></div>
</body>
</html>